# statistic about miss rate for attributes
# useage:awk -f sta_miss.awk training.txt
# @author:l0he1g&gmail.com
BEGIN{
	FS=",";
}

{
	if( FNR==1 ){	
		for( i=1; i<=NF;i++ ){
			name[i]=$i;
			miss[i]=0;
		}
	}
	else{
		for( j=1; j<=NF;j++ ){
			if( $j=="" || $j=="."){
				miss[j]++;
			}
		}
	}
}

END{
	tmp=1;
	for( i=1; i<=NF; i++ ){
		if( miss[i]!=0 ){
			percent=miss[i]/NR;
			#if( percent>=0.995 )
			{
				printf("%8d-%-.3f",i,percent);
				tmp++;
				if( tmp%8==0 )
					print "";
			}		   
		}
	}
	print "";
}
